package exercise7;

public class Exercise12_01_second {
    public static void main(String []args){

        int result;

        if (isNumeric(args[0])){

        }
        else {
            System.out.println("Wrong Input: " + args[0]);
        }

        if (isNumeric(args[2])){

        }
        else {
            System.out.println("Wrong Input: " + args[2]);
        }
        
        int num1=Integer.parseInt(args[0]);
        int num2=Integer.parseInt(args[2]);


        switch (args[1].charAt(0)) {
            case '+': result = num1 + num2;
                break;
            case '-': result = num1 - num2;
                break;
            case '*': result = num1 * num2;
                break;
            case '/': result = num1 / num2;
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + args[1].charAt(0));
        }
        System.out.println(args[0] + " " + args[1] + " " + args[2] + " = " + result);
    }
    public static boolean isNumeric(String str) {
        for (int i = 0; i < str.length(); i++) {
            if (!Character.isDigit(str.charAt(i))) {
                return false;
            }
        }
        return true;
    }
    
}
